<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<meta charset="utf-8">
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">  
<title>评论</title> 
<style type="text/css">
#b1{
	height:50px;
	width:400px;
	font-size: 30px;
	font-weight: bold;
}
#a2{
	border: 1px solid red;
}
</style> 
<script type="text/javascript"> 
    function delcfm(a) {
        if (!confirm("确认要删除？")) {
        	alert("删除失败");
        	location="hy.php";
        }
        else
        {
        	location="delete.php?id="+a;
        }
    }
</script>
</head>  
<body>  
  <h1>欢迎您的到来！</h1>
	<form name="myform" method="post" action="pinglun.php">
		<tr> 
			<td> 
				<table width="100%" border="0" cellspacing="3">
					<tr> 
						<td>发表评论：</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr> 
			<td>标题为：</td><br/>
			<td><input type="text" name="title"  autocomplete="off"/></td><br/>
			<td>评论内容为：</td><br/>
			<td ><TEXTAREA name="content" rows="6" cols="70" autocomplete="off"></TEXTAREA><br/> 
			</td>
		</tr>
		<tr> 
			<td ><input id='1' type="submit" value="comment" name="submit"/>
			<input type="reset" value="reset" name="reset"/> </td>
		</tr>
	</form>
<?php
session_start();
$username=$_SESSION['username'];
require_once("mysql.php"); 
/*$pdo=mysql_connect("localhost","root","1");
$bb=mysql_select_db("my_db",$pdo);*/
$resul=mysql_query("select * from test2");
echo "<form >";
echo "<table id='a2'>";
echo "<tr id='a2'><th id='a2'>评论者</th><th id='a2'>标题</th><th id='a2'>评论内容</th></tr>";
while($colum=mysql_fetch_array($resul))
{
	$c=$colum['id'];
	echo "<tr id='a2'><td id='a2'>";
	echo $colum['username'];
	echo "</td><td id='a2'>";
	echo $colum['title'];
	echo "</td><td id='a2'>";
	echo $colum['comment'];
	echo "</td>";
	if($username==$colum['username'])
	{
		echo "<td id='a2'>";
		echo "<input type='button' id='$c' onclick='delcfm(this.id)' value='delete' />";
		echo "</td>";
    }
	echo "</tr>";
}
?>
</body> 

</html>
